package com.ray.common.util;

import org.apache.commons.lang3.math.NumberUtils;

public class ColumnHelp
{
  public static int change(String columnName)
  {
    int resVal = -1;
    int i;
    try{
      resVal = NumberUtils.createInteger(columnName).intValue();
    } catch (Exception e) {
      columnName = columnName.trim().toUpperCase();
    } 
    for (i = 0; i < columnName.length(); i++) {
      int b = (int)Math.pow(26.0D, columnName.length() - 1 - i);
      resVal += (columnName.charAt(i) - '@') * b;
    }
    return resVal;
  }
}
